﻿<?xml version="1.0" encoding="utf-8" ?>
<AdoNetDataAccess connection="$ArticleDBConnection$" formatter="bizobj of Article">
	<Sql>
		SELECT
			a.id, a.baseTitle, a.isSystem, 
			t.objectId, t.parentId, t.parentHostId, 
			c.keyName, c.depth, c.rootId, c.treeName
		FROM
			Articles AS a
			INNER JOIN ObjectTreeNodes AS t ON a.id = t.objectId
			INNER JOIN ObjectTreeCounts AS c on c.objectId = a.id
		WHERE
			((a.uniqueTitle = @uniqueTitle) AND (a.companyId = @companyId) AND (a.uniqueTitle &lt;&gt; '') AND (c.treeName = @treeName)) OR
		  ((a.id = @id) AND (a.companyId = @companyId)) OR
		  ((a.companyId = @companyId) AND (c.keyName = @keyName))
	</Sql>
	<Param name="uniqueTitle" type="UnicodeVarChar" />
	<Param name="keyName" type="UnicodeVarChar" />
	<Param name="companyId" type="UniqueIdentifier" />
	<Param name="id" type="UniqueIdentifier" />
	<Param name="treeName" type="UnicodeVarChar" />
</AdoNetDataAccess>
